package main
import "fmt"

type Person struct{
	name string
	age int
	hobby []string
	map1 map[string]string
	Address 
	Email
}
type Address struct{
	city string
	stress string
}
type Email struct{
	email string
	count int
}
type Animal struct{
	Name string
}

func (a Animal)run(){
	fmt.Printf("%s正在跑!\n",a.Name)
}
type Dog struct{
	Age int
	*Animal
}
func (d Dog)bark(){
	fmt.Printf("%s正在叫\n",d.Name)
}

func main(){
	var p1 Person
	p1.name="zhangsan"
	p1.age=18
	// p1.hobby=make([]string,3,3)
	// p1.hobby[0]="bascketball"
	// p1.hobby[1]="pragram"
	// p1.hobby[2]="dance"
	p1.hobby=append(p1.hobby,"code")
	p1.hobby=append(p1.hobby,"football")
	p1.map1=make(map[string]string)
	p1.map1["addre"]="重庆"
	p1.map1["phone"]="156012323"
	p1.Address.city="毕节"
	p1.Address.stress="纳雍"
	p1.Email.email="cquptyyds@163.com"
	p1.Email.count=1
	fmt.Println(p1)

	dog:=Dog{
		Age:12,
		Animal:&Animal{//继承就是  嵌套
			Name:"zhangsan",
		},
	}
	dog.run()
	dog.bark()
}